package com.zxw.service.impl;

import com.zxw.domain.StorageTbl;
import com.zxw.mapper.StorageTblMapper;
import com.zxw.service.IStorageTblService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author zxw
 * @since 2020-10-16
 */
@Service
public class StorageTblServiceImpl extends ServiceImpl<StorageTblMapper, StorageTbl> implements IStorageTblService {
    @Autowired
    private JdbcTemplate jdbcTemplate;

    @Override
    public void deduct(String commodityCode, Integer count) {
        jdbcTemplate.update("update storage_tbl set count = count - ? where commodity_code = ?",
                new Object[] {count, commodityCode});
    }
// jdbcTemplate.update("update storage_tbl set count = count - ? where commodity_code = ?",
//         new Object[] {count, commodityCode});
}
